<template>
  <div class="home">
    <img src="http://www.atguigu.com/images/index_new/logo.png" alt="" />
  </div>
</template>

<script setup lang="ts" name="Home">
import { onMounted } from "vue";
import { useRouter } from "vue-router";
const router = useRouter(); // 获取路由器对象,useRouter()为一个hooks
// 首页展示3秒后跳转新闻页
onMounted(() => {
  setTimeout(() => {
    router.push({ path: "/news" }); // 使用路由器进行跳转
    // router.replace({ path: "/news" });
    // location.href = "/news"; // 利用浏览器地址栏进行跳转
  }, 3000);
});
</script>

<style scoped>
.home {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
}
</style>
